/**
 * 
 */
define([ 'platform.common' ], function(platform) {
	$(document).keydown(function(event) {
		platform.forbiddenEnter(event);
	});
	$.ajaxSetup({
		complete : function(xhr, textStatus) {
			switch (textStatus) {
			case 'success':
				var result = xhr.responseJSON;
				if (result == undefined) {
					break;
				}
				if (result.statusCode == 'RELOGIN'
						|| result.statusCode == 'HTTP_USER_LOGOUT_SUC'
						|| result.statusCode == 'SESSIONEXPIRED') {
					if (top !== self) {
						top.location.href = result.redirectUrl;
					}
					window.location.href = result.redirectUrl;
				}
				if (result.statusCode == 'UNAUTHORIZE') {
					window.top.$('iframe:first')
							.attr('src', result.redirectUrl);
				}
				break;
			case 'error':
				// platform.confirm('系统提示', 'small', '系统出现异常!', '详情查看', '忽略',
				// 		function() {
				// 		}, function() {
				// 		});
				break;
			case 'parsererror':
				break;
			}
		}
	})
});